<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    MaintainScrollPositionOnPostback="true" CodeFile="ApplicationDataEntry.aspx.cs"
    Inherits="ApplicationDataEntry" Title="APM - Application Entry" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <ul id="path">
        <li><a href="../Home.aspx">Home</a> &gt;</li>
        <li>Application &gt;</li>
        <li>Application Entry</li>
    </ul>
    <h3 class="entry">
        <span>Application Entry</span></h3>
    <div id="content">
        <div id="tabgroup">
            <ul class="tabs">
                <li id="addl" runat="server" class="active">
                    <asp:LinkButton ID="lbnew" Style="text-align: center" runat="server" CausesValidation="false"
                        Text="Add New Application" ToolTip="For adding new application entry into system."
                        OnClick="lbnew_Click"></asp:LinkButton></li>
                <li id="viewl" runat="server">
                    <asp:LinkButton ID="lbview" runat="server" Style="text-align: center" CausesValidation="false"
                        Text=" View Application Data " ToolTip="For viewing existing applications in the system."
                        OnClick="lbview_Click"></asp:LinkButton></li>
                <li id="editl" runat="server">
                    <asp:LinkButton ID="lbedit" runat="server" Style="text-align: center" CausesValidation="false"
                        Text=" Edit Application Data" ToolTip="For editing existing applications in the system."
                        OnClick="lbedit_Click"></asp:LinkButton></li>
            </ul>
            <div class="frame" style="min-height: 550px;">
                <asp:Panel runat="server" ID="pnlApplication">
                    <asp:Panel runat="server" ID="pnlError" Visible="false" GroupingText="Error">
                        <table width="100%">
                            <tr>
                                <td style="width: 150px; font-weight: bold">
                                    Application Entry - Status:
                                </td>
                                <td>
                                    <asp:Label runat="server" ID="lblStatus" ForeColor="Red">Error</asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td style="font-weight: bold">
                                    Error Details:
                                </td>
                                <td>
                                    <asp:Label runat="server" ID="lblDetails" ForeColor="Red">Insufficient Permissions to Update </asp:Label>
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                    <asp:Panel ID="pnlCopy" runat="server" Width="100%" GroupingText="Copy Application Information"
                        ToolTip="Click here to copy the Data of an existing application.">
                        <table width="100%">
                            <tr>
                                <td align="left" style="width: 140px">
                                    <asp:Label ID="Label1" runat="server" Text="Application ID" Visible="true"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox CssClass="input" ID="txtApplicationID" runat="server" ReadOnly="false"
                                        Width="150" MaxLength="15" Visible="true"></asp:TextBox>
                                    <asp:Button ID="btnCopy" ValidationGroup="copy" runat="server" OnClick="btnCopy_Click"
                                        Text="Copy" ToolTip="Click here to copy the Metadata, Properties and Contacts of this Application."
                                        CausesValidation="true" Visible="true" />
                                    <asp:RegularExpressionValidator ID="revApplicationID" ValidationGroup="copy" runat="server"
                                        ControlToValidate="txtApplicationID" ErrorMessage="Invalid Input: Application ID"
                                        ValidationExpression="<%$ AppSettings:AppIDRegEx %>" SetFocusOnError="true" Display="None"></asp:RegularExpressionValidator>
                                    <asp:RequiredFieldValidator ValidationGroup="copy" ID="reqValidatorforCopy" runat="server"
                                        ControlToValidate="txtApplicationID" ErrorMessage="Required Field: Application ID"
                                        Display="None" SetFocusOnError="True"></asp:RequiredFieldValidator>
                                    <asp:ValidationSummary ValidationGroup="copy" ID="copyValidation" runat="server"
                                        HeaderText="Please correct the following:" ShowMessageBox="true" ShowSummary="false"
                                        DisplayMode="BulletList" />
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                    <asp:Panel ID="pnlAppMetaData" runat="server" Width="100%" GroupingText="Application Metadata">
                        <table width="100%">
                            <tr>
                                <td align="left" style="width: 140px">
                                    <asp:Label ID="lblAppOwner" runat="server">Application Creator</asp:Label>
                                </td>
                                <td>
                                    <asp:Label ID="lblAppOwnerText" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <asp:Panel Visible="false" runat="server" ID="pnlApplicationID">
                                <tr>
                                    <td align="left">
                                        <asp:Label ID="lblAppID" runat="server" Text="Application ID"></asp:Label>
                                    </td>
                                    <td>
                                        <asp:TextBox CssClass="input" ID="txtAppID" runat="server" MaxLength="50" Enabled="true"
                                            ReadOnly="true" Width="150"></asp:TextBox>
                                    </td>
                                </tr>
                            </asp:Panel>
                            <tr>
                                <td align="left" style="width: 140px">
                                    <asp:Label ID="lblApplicationName" runat="server">Application Name</asp:Label>
                                </td>
                                <td>
                                    <table cellpadding="0" cellspacing="0">
                                        <tr>
                                            <td>
                                                <asp:TextBox CssClass="input" ID="txtApplicationName" runat="server" MaxLength="50"
                                                    Width="150"></asp:TextBox>
                                            </td>
                                            <td>
                                                <label class="example">
                                                    &nbsp; Example - Microsoft Word</label>
                                                <asp:RequiredFieldValidator ValidationGroup="app" ID="vrfApplicationName" runat="server"
                                                    ControlToValidate="txtApplicationName" ErrorMessage="Required Field: Application Name"
                                                    Display="None" SetFocusOnError="True"></asp:RequiredFieldValidator>
                                                <asp:RegularExpressionValidator ID="revAppName" runat="server" ControlToValidate="txtApplicationName"
                                                    Display="None" ErrorMessage="Invalid Input: Application Name" ValidationExpression="<%$ AppSettings:AppNameRegEx %>"
                                                    ValidationGroup="app"></asp:RegularExpressionValidator>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="lblOrganizationName" runat="server" Text="">Organization Name</asp:Label>
                                </td>
                                <td>
                                    <asp:DropDownList ID="ddlOrgName" DataTextField="OrgName" DataValueField="OrgID"
                                        runat="server" Width="154px" AppendDataBoundItems="True">
                                        <asp:ListItem Value="">No Selection</asp:ListItem>
                                    </asp:DropDownList>
                                    <asp:RequiredFieldValidator ID="vrfOrgName" runat="server" SetFocusOnError="true"
                                        Display="None" ValidationGroup="app" ControlToValidate="ddlOrgName" ErrorMessage="Required Field: Organization Name"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td align="left">
                                    <asp:Label ID="lblVersion" runat="server" Text="">Version Number</asp:Label>
                                </td>
                                <td>
                                    <table cellpadding="0" cellspacing="0">
                                        <tr>
                                            <td>
                                                <asp:TextBox CssClass="input" ID="txtVersion" runat="server" MaxLength="50" Width="150"></asp:TextBox>
                                                &nbsp;</td>
                                            <td>
                                                Example - 1.25
                                                <asp:RequiredFieldValidator ValidationGroup="app" ID="vrfVersion" runat="server"
                                                    ControlToValidate="txtVersion" ErrorMessage="Required Field: Version Number"
                                                    Display="None" SetFocusOnError="True"></asp:RequiredFieldValidator>
                                                <asp:RegularExpressionValidator ID="regularVersion" runat="server" ControlToValidate="txtVersion"
                                                    Display="None" ErrorMessage="Invalid Input: Version Number" ValidationExpression="<%$ AppSettings:AppVersionNumRegEx %>"
                                                    ValidationGroup="app"></asp:RegularExpressionValidator></td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td align="left" valign="top">
                                    <asp:Label ID="lblDescription" runat="server" Text="Description"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtDescription" runat="server" MaxLength="1000" onkeypress="verifyMax(this, 1000)"
                                        Rows="4" onpaste="verifyPaste(this, 1000, 'Description')" TextMode="MultiLine"
                                        Width="525px"></asp:TextBox>
                                    <asp:RegularExpressionValidator ValidationGroup="app" ID="regDesc" runat="server"
                                        ControlToValidate="txtDescription" ErrorMessage="Invalid Input: Description "
                                        ValidationExpression="<%$ AppSettings:AppDescRegEx %>" Display="None"></asp:RegularExpressionValidator>
                                </td>
                            </tr>
                            <tr>
                                <td align="left">
                                    <asp:Label ID="lblStartDate" runat="server" Text="">Start Date</asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox CssClass="input" ID="txtStartDate" MaxLength="50" runat="server" Width="80"></asp:TextBox>&nbsp;<asp:Label
                                        ID="lblCalStartDate" runat="server"><img id="imgStartDate" alt="" style="vertical-align:top;height:20px;width:20px;border:0px;" src="../Images/calendar.png"/><label class="example"> &nbsp; 'mm/dd/yyyy' </label>
                                    </asp:Label><ajaxToolkit:CalendarExtender ID="csStartDate" runat="server" TargetControlID="txtStartDate"
                                        PopupButtonID="imgStartDate">
                                    </ajaxToolkit:CalendarExtender>
                                    <asp:RequiredFieldValidator ValidationGroup="app" ID="vrfStartdate" runat="server"
                                        ControlToValidate="txtStartDate" ErrorMessage="Required Field: Start date" Display="None"
                                        SetFocusOnError="True"></asp:RequiredFieldValidator>
                                    <asp:CompareValidator ValidationGroup="app" ID="cvStartDate" runat="server" Operator="DataTypeCheck"
                                        Type="Date" ErrorMessage="Invalid Input: Start Date" ControlToValidate="txtStartDate"
                                        Display="None"></asp:CompareValidator>
                                    <asp:CompareValidator ID="cmpSqlstart" runat="server" ControlToValidate="txtStartDate"
                                        Display="None" ErrorMessage="Invalid Input: Start Date" Operator="GreaterThan"
                                        SetFocusOnError="True" Type="Date" ValidationGroup="app" ValueToCompare="1/1/1753"></asp:CompareValidator>
                                </td>
                            </tr>
                            <tr>
                                <td align="left">
                                    <asp:Label ID="lblEstCompletionDate" runat="server" Text="">Estimated Completion Date&nbsp;</asp:Label></td>
                                <td>
                                    <asp:TextBox CssClass="input" ID="txtCompletionDate" runat="server" MaxLength="50"
                                        Width="80"></asp:TextBox>&nbsp;<asp:Label ID="lblCalEstCompletion" runat="server"><img style="vertical-align:top;height:20px;width:20px;border:0px;" id="imgEstCompletion" alt="" src="../Images/calendar.png"/></asp:Label><label
                                            class="example">
                                            &nbsp; 'mm/dd/yyyy'
                                        </label>
                                    <ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtCompletionDate"
                                        PopupButtonID="imgEstCompletion">
                                    </ajaxToolkit:CalendarExtender>
                                    <asp:RequiredFieldValidator ValidationGroup="app" ID="rfvEstDate" runat="server"
                                        ControlToValidate="txtCompletionDate" ErrorMessage="Required Field: Estimated Completion Date"
                                        SetFocusOnError="true" Display="None"></asp:RequiredFieldValidator>
                                    <asp:CompareValidator ValidationGroup="app" ID="cvEstDate" runat="server" ControlToValidate="txtCompletionDate"
                                        Operator="DataTypeCheck" Type="Date" ErrorMessage="Invalid Input: Estimated Completion Date"
                                        Display="None" SetFocusOnError="True"></asp:CompareValidator>
                                    <asp:CompareValidator ID="vcrDate" runat="server" ControlToCompare="txtStartDate"
                                        ControlToValidate="txtCompletionDate" Display="None" ErrorMessage="Invalid Input: Estimated Completion Date should be greater than the Start Date"
                                        Operator="GreaterThan" SetFocusOnError="True" Type="Date" ValidationGroup="app"></asp:CompareValidator>
                                </td>
                            </tr>
                        </table>
                        <asp:Panel ID="pnlCompletedDate" runat="server" Visible="False" Width="100%">
                            <table>
                                <tr>
                                    <td align="left" style="width: 140px">
                                        <asp:Label ID="lblActualCopletedDate" runat="server" Text="Actual Completed Date"></asp:Label>
                                    </td>
                                    <td>
                                        <asp:TextBox CssClass="input" ID="txtActualCompletedDate" runat="server" MaxLength="50"
                                            Width="80"></asp:TextBox>&nbsp;<asp:Label ID="lblCalActulalCompletion" runat="server"><img src="../Images/calendar.png" style="vertical-align:top;height:20px;width:20px;border:0px;"  alt="" id="imgActualCompletion"/></asp:Label><label
                                                class="example">
                                                &nbsp; 'mm/dd/yyyy'
                                            </label>
                                        <ajaxToolkit:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtActualCompletedDate"
                                            PopupButtonID="imgActualCompletion">
                                        </ajaxToolkit:CalendarExtender>
                                        <asp:CompareValidator ValidationGroup="edit" ID="cvActualDate" runat="server" ControlToValidate="txtActualCompletedDate"
                                            Operator="DataTypeCheck" Type="Date" ErrorMessage="Invalid Input: Actual Completed date"
                                            Display="None" SetFocusOnError="True"></asp:CompareValidator>
                                        <asp:CompareValidator ValidationGroup="edit" ID="vcrCompletion" runat="server" ControlToCompare="txtStartDate"
                                            ControlToValidate="txtActualCompletedDate" Display="None" ErrorMessage=" Actual Completion date should be greater than Start date"
                                            Type="Date" Operator="GreaterThan"></asp:CompareValidator>
                                    </td>
                                </tr>
                            </table>
                            <br />
                        </asp:Panel>
                    </asp:Panel>
                    <asp:Panel runat="server" ID="pnlAppProperty" GroupingText="Application Properties">
                        <table width="100%">
                            <asp:Panel runat="server" ID="pnlAppPropertyAdd">
                                <tr>
                                    <td>
                                        <table width="100%">
                                            <tr>
                                                <td style="width: 138px;" valign="top">
                                                    Application Property
                                                </td>
                                                <td>
                                                    <asp:ListBox runat="server" ID="lstAttribute" Rows="7" SelectionMode="Multiple" Width="100%">
                                                    </asp:ListBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="2" align="left">
                                                    <input type="button" id="btnClear" value=" Reset " onclick="Reset()" title="Click this button to clear the Selected Attributes." />
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </asp:Panel>
                        </table>
                    </asp:Panel>
                    <asp:Panel runat="server" ID="pnlAppContact" GroupingText="Application Contacts">
                        <table width="100%">
                            <asp:Panel runat="server" ID="pnlAppContactAdd">
                                <tr>
                                    <td>
                                        <table>
                                            <tr>
                                                <td>
                                                    Alias
                                                </td>
                                                <td>
                                                </td>
                                                <td>
                                                    Contact Type
                                                </td>
                                                <td>
                                                    Name
                                                </td>
                                                <td>
                                                    E-mail
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:TextBox runat="server" ID="txtInsertAlias" MaxLength="200" Width="120"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="rfvAlias" runat="server" SetFocusOnError="true" Display="None"
                                                        ControlToValidate="txtInsertAlias" ErrorMessage="Required Field: Alias " ValidationGroup="find"></asp:RequiredFieldValidator>
                                                    <asp:RegularExpressionValidator ID="revAlias" runat="server" ControlToValidate="txtInsertAlias"
                                                        Display="None" ErrorMessage="Invalid Input: Alias" ValidationExpression="<%$ AppSettings:UserNameRegEx %>"
                                                        ValidationGroup="find"></asp:RegularExpressionValidator>
                                                    <asp:RequiredFieldValidator ID="rfvAlias1" runat="server" SetFocusOnError="true"
                                                        Display="None" ControlToValidate="txtInsertAlias" ErrorMessage="Required Field: Alias "
                                                        ValidationGroup="insert"></asp:RequiredFieldValidator>
                                                    <asp:RegularExpressionValidator ID="revAlias1" runat="server" ControlToValidate="txtInsertAlias"
                                                        ErrorMessage="Invalid Input: Alias" ValidationExpression="<%$ AppSettings:UserNameRegEx %>"
                                                        Display="None" ValidationGroup="insert"></asp:RegularExpressionValidator>
                                                    <asp:ValidationSummary ID="vsAlias" runat="server" HeaderText="Please correct the following:"
                                                        ShowMessageBox="true" ShowSummary="false" DisplayMode="BulletList" ValidationGroup="find" />
                                                    <asp:ValidationSummary ID="ValidationSummary2" runat="server" HeaderText="Please correct the following:"
                                                        ShowMessageBox="true" ShowSummary="false" DisplayMode="BulletList" ValidationGroup="insert" />
                                                    <asp:ValidationSummary ID="ValidationSummary3" runat="server" HeaderText="Please correct the following:"
                                                        ShowMessageBox="true" ShowSummary="false" DisplayMode="BulletList" ValidationGroup="edit" />
                                                </td>
                                                <td>
                                                    <asp:Button ID="btnFindUser" Text="Find User" runat="server" CausesValidation="true"
                                                        ValidationGroup="find" OnClick="btnFindUser_Click" ToolTip =" Click this button to search for the user in Active Directory. This supports only exact search for the alias entered in the textbox. " />
                                                </td>
                                                <td>
                                                    <asp:DropDownList runat="server" ID="ddlInsertContactType" Width="170">
                                                        <asp:ListItem Selected="True" Text="No Selection" Value=""></asp:ListItem>
                                                    </asp:DropDownList>
                                                    <asp:RequiredFieldValidator InitialValue="" ID="rfvContactType" runat="server" SetFocusOnError="true"
                                                        Display="None" ControlToValidate="ddlInsertContactType" ErrorMessage="Required Field: Contact Type "
                                                        ValidationGroup="insert"></asp:RequiredFieldValidator>
                                                </td>
                                                <td>
                                                    <asp:TextBox runat="server" ID="txtInsertName" MaxLength="200" Width="146"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="rfvName" runat="server" SetFocusOnError="true" Display="None"
                                                        ControlToValidate="txtInsertName" ErrorMessage="Required Field: Name " ValidationGroup="insert"></asp:RequiredFieldValidator>
                                                    <asp:RegularExpressionValidator ID="revName" runat="server" ControlToValidate="txtInsertName"
                                                        ErrorMessage="Invalid Input: Name" ValidationExpression="<%$ AppSettings:UserNameRegEx %>"
                                                        Display="None" ValidationGroup="insert"></asp:RegularExpressionValidator>
                                                </td>
                                                <td>
                                                    <asp:TextBox runat="server" ID="txtInsertEmail" MaxLength="250" Width="146"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="rfvEmail" runat="server" SetFocusOnError="true" ValidationGroup="insert"
                                                        Display="None" ControlToValidate="txtInsertEmail" ErrorMessage="Required Field: E-mail "></asp:RequiredFieldValidator>
                                                    <asp:RegularExpressionValidator ID="revEmail" runat="server" ControlToValidate="txtInsertEmail"
                                                        ValidationGroup="insert" Display="None" ErrorMessage="Invalid Input: E-mail"
                                                        ValidationExpression="<%$ AppSettings:UserEmailRegEx %>"></asp:RegularExpressionValidator>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <asp:Button ID="btnAdd" runat="server" Text="Insert" ToolTip="Click this button to insert the New Contact"
                                            OnClick="btnAdd_Click" ValidationGroup="insert" CausesValidation="true" />
                                    </td>
                                </tr>
                            </asp:Panel>
                            <tr>
                                <td>
                                    <br />
                                    Existing Application Contacts
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:GridView ID="gridApplicationContact" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                                        OnRowEditing="gridAppContact_RowEditing" AutoGenerateEditButton="False" CssClass="table"
                                        DataKeyNames="ContactTypeID" EmptyDataText="No Contacts found." OnRowCancelingEdit="gridAppContact_RowCancel"
                                        PageSize="10" OnRowDataBound="gridAppContact_RowDataBound" OnRowDeleting="gridAppContact_RowDeleting"
                                        OnRowUpdating="gridAppContact_RowUpdating" OnPageIndexChanging="gridAppContact_PageIndexChanging">
                                        <AlternatingRowStyle CssClass="alternate" />
                                        <PagerSettings Position="Top" />
                                        <PagerStyle CssClass="pages" />
                                        <EmptyDataRowStyle BackColor="#C4D7D6" BorderStyle="none" />
                                        <HeaderStyle HorizontalAlign="Left" />
                                        <Columns>
                                            <asp:CommandField ShowCancelButton="true" ShowDeleteButton="true" DeleteText="Remove"
                                                ItemStyle-Width="90" ShowEditButton="true" HeaderText="Select" ButtonType="link"
                                                CausesValidation="true" ValidationGroup="edit" HeaderStyle-HorizontalAlign="left"
                                                ItemStyle-HorizontalAlign="left">
                                                <ItemStyle Wrap="False" />
                                            </asp:CommandField>
                                            <asp:TemplateField HeaderText="Alias">
                                                <ItemTemplate>
                                                    <%# Microsoft.Security.Application.AntiXss.HtmlEncode(Eval("Alias").ToString()) %>
                                                </ItemTemplate>
                                                <EditItemTemplate>
                                                    <asp:TextBox ID="txtEditAlias" runat="Server" Text='<%# Bind("Alias") %>' MaxLength="50"
                                                        Width="90" CssClass="input" />
                                                    <asp:RequiredFieldValidator ID="rfvEditAlias" runat="server" SetFocusOnError="true"
                                                        Display="None" ControlToValidate="txtEditAlias" ErrorMessage="Required Field: Alias "
                                                        ValidationGroup="edit"></asp:RequiredFieldValidator>
                                                    <asp:RegularExpressionValidator ID="revEditAlias" runat="server" ControlToValidate="txtEditAlias"
                                                        ErrorMessage="Invalid Input: Alias" ValidationExpression="<%$ AppSettings:UserNameRegEx %>"
                                                        Display="None" ValidationGroup="edit"></asp:RegularExpressionValidator>
                                                </EditItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Contact Type" ItemStyle-Width="170">
                                                <ItemTemplate>
                                                    <asp:Label runat="server" ID="lblContactType" Text='<%# Microsoft.Security.Application.AntiXss.HtmlEncode(Eval("ContactTypeName").ToString()) %>'></asp:Label>
                                                </ItemTemplate>
                                                <EditItemTemplate>
                                                    <asp:DropDownList runat="server" ID="ddlEditContactType">
                                                    </asp:DropDownList>
                                                </EditItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Name" ItemStyle-Width="146">
                                                <ItemTemplate>
                                                    <%# Microsoft.Security.Application.AntiXss.HtmlEncode(Eval("Name").ToString()) %>
                                                </ItemTemplate>
                                                <EditItemTemplate>
                                                    <asp:TextBox ID="txtEditName" runat="Server" Text='<%# Bind("Name") %>' MaxLength="50"
                                                        CssClass="input" />
                                                    <asp:RequiredFieldValidator ID="rfvEditName" runat="server" SetFocusOnError="true"
                                                        Display="None" ControlToValidate="txtEditName" ErrorMessage="Required Field: Name "
                                                        ValidationGroup="edit"></asp:RequiredFieldValidator>
                                                    <asp:RegularExpressionValidator ID="revEditName" runat="server" ControlToValidate="txtEditName"
                                                        ErrorMessage="Invalid Input: Name" ValidationExpression="<%$ AppSettings:UserNameRegEx %>"
                                                        Display="None" ValidationGroup="edit"></asp:RegularExpressionValidator>
                                                </EditItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="E-mail" ItemStyle-Width="146">
                                                <ItemTemplate>
                                                    <%# Microsoft.Security.Application.AntiXss.HtmlEncode(Eval("Email").ToString()) %>
                                                </ItemTemplate>
                                                <EditItemTemplate>
                                                    <asp:TextBox ID="txtEditEmail" runat="Server" Text='<%# Bind("Email") %>' MaxLength="50"
                                                        CssClass="input" />
                                                    <asp:RequiredFieldValidator ID="rfvEditEmail" runat="server" SetFocusOnError="true"
                                                        ValidationGroup="edit" Display="None" ControlToValidate="txtEditEmail" ErrorMessage="Required Field: E-mail "></asp:RequiredFieldValidator>
                                                    <asp:RegularExpressionValidator ID="revEditEmail" runat="server" ControlToValidate="txtEditEmail"
                                                        Display="None" ErrorMessage="Invalid Input: E-mail" ValidationExpression="<%$ AppSettings:UserEmailRegEx %>"
                                                        ValidationGroup="edit"></asp:RegularExpressionValidator>
                                                </EditItemTemplate>
                                            </asp:TemplateField>
                                        </Columns>
                                        <RowStyle HorizontalAlign="Left" />
                                    </asp:GridView>
                                    <asp:Panel runat="server" ID="pnlContactError" Visible="false">
                                        &nbsp;<asp:Label runat="server" ID="llbContactError" Text="Note: Edit the above highlighted Application Contact Types that are now disabled in system"></asp:Label>
                                    </asp:Panel>
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                    <asp:Panel runat="server" ID="pnlButtons">
                        <br />
                        <asp:Button ID="btnSubmit" runat="server" Text="Submit" ValidationGroup="app" OnClick="btnSubmit_Click" />
                        <asp:Button ID="btnUpdate" runat="server" OnClick="btnUpdate_Click" Text="Submit"
                            Visible="False" />
                        <asp:Button ID="btnReset" runat="server" Text="Reset" OnClick="btnReset_Click" CausesValidation="False" />
                        <asp:ValidationSummary ID="vsumApplication" ValidationGroup="app" runat="server"
                            HeaderText="Please correct the following:" ShowMessageBox="true" ShowSummary="false"
                            DisplayMode="BulletList" />
                    </asp:Panel>
                </asp:Panel>
                <asp:Panel ID="pnlSearch" runat="server" Width="100%" Visible="false">
                    <table class="table" border="0" cellpadding="0" cellspacing="0" width="100%">
                        <tr align="center">
                            <th colspan="2">
                                Quick Search
                            </th>
                        </tr>
                        <tr>
                            <td align="left" style="padding: 0 0 0 0;" colspan="2">
                                <asp:HiddenField runat="server" ID="appID" Value="0" Visible="false" />
                                <asp:RadioButtonList ToolTip="Select to search by Application Name or by Application ID."
                                    runat="server" ID="rdsearchType" AutoPostBack="false" TextAlign="Right" RepeatDirection="Horizontal">
                                    <asp:ListItem Selected="true" Value="0"> Search by Application Name</asp:ListItem>
                                    <asp:ListItem Value="1">Search by Application ID</asp:ListItem>
                                </asp:RadioButtonList>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" colspan="2">
                                <table cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td align="left" style="padding: 0 0 0 0;">
                                            <asp:TextBox ID="txtSearch" runat="server" MaxLength="50" ValidationGroup="search"
                                                Width="220" CssClass="input"></asp:TextBox>
                                            <asp:RequiredFieldValidator ValidationGroup="search" ID="reqAppName" runat="server"
                                                ControlToValidate="txtSearch" ErrorMessage="Required Field: Application Name/ID"
                                                Display="None" SetFocusOnError="True"></asp:RequiredFieldValidator>
                                            <asp:RegularExpressionValidator ValidationGroup="search" ID="reguAppName" runat="server"
                                                ControlToValidate="txtSearch" ErrorMessage="Invalid Input: Application Name/ID"
                                                ValidationExpression="<%$ AppSettings:AppNameRegEx %>" Display="None"></asp:RegularExpressionValidator>
                                            <asp:Button ID="btnSearch" runat="server" ValidationGroup="search" OnClick="btnSearch_Click"
                                                Text="Search" />
                                        </td>
                                        <td>
                                            &nbsp;Example - Microsoft Word or 56</td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" colspan="2">
                                <asp:Label ID="lblResult" runat="server" Text="Select Application" Visible="false"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" colspan="2">
                                <asp:ListBox Width="275" Rows="5" ID="lstApplicationNames" runat="server" Visible="False">
                                </asp:ListBox>
                                <asp:RequiredFieldValidator ValidationGroup="Go" ID="RequiredFieldValidator1" runat="server"
                                    ControlToValidate="lstApplicationNames" ErrorMessage="No application was selected."
                                    Display="None" SetFocusOnError="True"></asp:RequiredFieldValidator>
                                <asp:ValidationSummary ValidationGroup="Go" ID="ValidationSummary1" runat="server"
                                    HeaderText="Please correct the following:" ShowMessageBox="true" ShowSummary="false"
                                    DisplayMode="BulletList" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" align="left">
                                <asp:Button ID="btnGo" runat="server" ValidationGroup="Go" OnClick="btnGo_Click"
                                    CausesValidation="true" Text="Select" Visible="false" />
                                <asp:ValidationSummary ValidationGroup="search" ID="commonValidation" runat="server"
                                    HeaderText="Please correct the following:" ShowMessageBox="true" ShowSummary="false"
                                    DisplayMode="BulletList" />
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
            </div>
        </div>
    </div>
</asp:Content>
